package com.example.spring.boot.rabbitmq.configure;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DemoConfirmCallBack implements RabbitTemplate.ConfirmCallback {


    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        String messageId = correlationData.getId();
        boolean ackRes = ack;
        System.out.println("收到消息id=" + messageId + ",ack=" + ackRes + ",失败原因=" + cause);
    }
}
